package com.easy.system.dao;

import com.easy.system.util.Condition;
import com.easy.system.util.Pagination;
import org.springframework.dao.DataAccessException;
import org.springframework.orm.hibernate3.HibernateOperations;
import org.springframework.orm.hibernate3.HibernateTemplate;

import java.util.List;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * User: sunguangzhu
 * Date: 13-6-18
 * Time: 下午1:19
 * To change this template use File | Settings | File Templates.
 * 封装基本操作数据库的方法
 * 增删改查
 */

public interface BaseDao<T> {


    /**
     * 保存对象(pass)
     *
     * @param entity
     */
    public void save(T entity);

    /**
     * 更新对象(pass)
     *
     * @param entity
     */
    public void update(T entity);

    /**
     * 删除对象(pass)
     *
     * @param entity
     */
    public void delete(T entity);

    public int delete(Class<T> clazz, String ids);

    /**
     * 根据id得到对象(pass)
     *
     * @param id
     * @return
     */
    public T get(Class<T> clazz, Long id);

    /**
     * @param condition
     * @param pagination
     * @return
     */
    public List<T> find(Condition condition, Pagination pagination);

    /**
     * @param clazz
     * @return
     */
    public Long getTotal(Class<T> clazz);

    /**
     * @param condition
     * @return
     */
    public Long getTotal(Condition condition);

}
